﻿#ifndef HTTPROUTER_H
#define HTTPROUTER_H

#include "httpcontroller.h"

#include <httprequesthandler.h>
using namespace stefanfrings;

class HttpRouter : public HttpRequestHandler
{
public:
    explicit HttpRouter(QObject *parent = nullptr);
    ~HttpRouter();
    void service(HttpRequest &request, HttpResponse &response) override;

    void installController(QString path, HttpController *httpController);

    bool getAuthorizeGuard() const;
    void setAuthorizeGuard(bool value);

private:
    QHash<QString, HttpController *> m_requestMap;
    bool authorizeGuard;
};

#endif // HTTPROUTER_H
